import request from '@/utils/request'

/**
 *获取企业列表
 * @param {*} params
 * @returns
 */
const getEnterpriseListAPI = params => {
  return request({
    url: 'park/enterprise',
    params
  })
}

/**
 *
 * @returns 获取行业列表
 */
const getIndustryListAPI = () => {
  return request({
    url: 'park/industry'
  })
}

// 营业执照上传
const uploadAPI = data => {
  return request({
    url: 'upload',
    method: 'post',
    data
  })
}

// 增加企业 park/enterprise
const createRentAPI = data => {
  return request({
    url: 'park/enterprise',
    method: 'post',
    data
  })
}

// 企业数据回显
const getEnterpriseDetailAPI = id => {
  return request({
    url: `park/enterprise/${id}`
  })
}

// 编辑企业
const updateExterpriseAPI = data => {
  return request({
    url: '/park/enterprise',
    method: 'PUT',
    data
  })
}

// 删除企业
const delExterpriseAPI = id => {
  return request({
    url: `park/enterprise/${id}`,
    method: 'delete'
  })
}
// 获取楼宇列表
const getRentBuildListAPI = () => {
  return request({
    url: 'park/rent/building'
  })
}

// 创建合同
const createRentAPI2 = data => {
  return request({
    url: 'park/enterprise/rent',
    method: 'post',
    data
  })
}

// 获取合同列表
const getRentListAPI = id => {
  return request({
    url: `park/enterprise/rent/${id}`
  })
}
// 退租
const outRentAPI = id => {
  return request({
    url: `park/enterprise/rent/${id}`,
    method: 'put'
  })
}

// 获取详情
const getEnterpriseDetail = id => {
  return request({
    url: `/park/enterprise/${id}`,
    method: 'GET'
  })
}
export {
  getEnterpriseListAPI,
  getIndustryListAPI,
  uploadAPI,
  createRentAPI,
  getEnterpriseDetailAPI,
  updateExterpriseAPI,
  delExterpriseAPI,
  getRentBuildListAPI,
  createRentAPI2,
  getRentListAPI,
  outRentAPI,
  getEnterpriseDetail
}
